package com.ruoyi.project.system.goods.follow.service.impl;

import javax.annotation.Resource;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.common.utils.uniquekey.IdGererateFactory;
import com.ruoyi.project.system.goods.follow.dto.GoodsFollowDto;
import com.ruoyi.project.system.goods.follow.mapper.GoodsFollowMapper;
import com.ruoyi.project.system.goods.follow.domain.GoodsFollow;
import com.ruoyi.project.system.goods.follow.service.IGoodsFollowService;
import com.ruoyi.common.utils.text.Convert;

/**
 * 产品关注Service业务层处理
 * 
 * @author LCL
 * @date 2020-06-26
 */
@Service
public class GoodsFollowServiceImpl implements IGoodsFollowService 
{
    @Resource
    private IdGererateFactory idGererateFactory;
    @Autowired
    private GoodsFollowMapper goodsFollowMapper;

    /**
     * 查询产品关注
     * 
     * @param id 产品关注ID
     * @return 产品关注
     */
    @Override
    public GoodsFollow selectGoodsFollowById(String id)
    {
        return goodsFollowMapper.selectGoodsFollowById(id);
    }

    /**
     * 查询产品关注列表
     * 
     * @param goodsFollow 产品关注
     * @return 产品关注
     */
    @Override
    public List<GoodsFollow> selectGoodsFollowList(GoodsFollow goodsFollow)
    {
        return goodsFollowMapper.selectGoodsFollowList(goodsFollow);
    }

    /**
     * 新增产品关注
     * 
     * @param goodsFollow 产品关注
     * @return 结果
     */
    @Override
    public int insertGoodsFollow(GoodsFollow goodsFollow)
    {
        goodsFollow.setId(this.idGererateFactory.nextStringId());
        return goodsFollowMapper.insertGoodsFollow(goodsFollow);
    }

    /**
     * 修改产品关注
     * 
     * @param goodsFollow 产品关注
     * @return 结果
     */
    @Override
    public int updateGoodsFollow(GoodsFollow goodsFollow)
    {
        return goodsFollowMapper.updateGoodsFollow(goodsFollow);
    }

    /**
     * 删除产品关注对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteGoodsFollowByIds(String ids)
    {
        return goodsFollowMapper.deleteGoodsFollowByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除产品关注信息
     * 
     * @param id 产品关注ID
     * @return 结果
     */
    @Override
    public int deleteGoodsFollowById(String id)
    {
        return goodsFollowMapper.deleteGoodsFollowById(id);
    }

    @Override
    public GoodsFollow findByUidAndGid(String memberId, String goodsId) {
        return this.goodsFollowMapper.findByUidAndGid(memberId,goodsId);
    }

    @Override
    public List<GoodsFollowDto> findListByUid(String uid) {
        return this.goodsFollowMapper.findListByUid(uid);
    }
}
